<?php

class Page_Table_Model_Page extends Database_Model_Item
{
	protected $_pk = 'page_id';

	protected $_itemType = 'page';

	function getAlias()
	{
		if ($this -> alias)
		{
			return $this -> alias;
		}
		return 'page-' . $this -> getId();
	}

	/**
	 * process to anchor
	 * @return string
	 */
	public function getUrl($p = '', $q = NULL)
	{
		$alias = $this -> getAlias();

		$q = '';

		if ($q)
		{
			$p .= '?' . http_build_query($q);
		}

		if ($p)
		{
			$alias .= '/' . $p;
		}

		return Nuo::getUrl($alias);
	}

}
